<?php 
/** create by fu */
namespace app\api\Controller\v1;

use app\api\model\Category as CategoryModel; 
use app\lib\exception\CategoryException; 
/**
 * 
 */
class Category 
{
	
	public function getAllCategories(){
		 
	    // $result = CategoryModel::with('img')->select();
	    $result = CategoryModel::all([],'img');//另一种写法 效果同上

        if($result->isEmpty())throw new CategoryException();
        
        return $result;
	}
}




 ?>